home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_b / siofix.asm < prev    next >
Assembly Source File  |  1995-04-22  |  3KB  |  66 lines

  1. ;      ---------------------------------------------------------------- 
  2. ;      1027 Printer Timeout Fix  (Ver. 2)                 (AUTORUN.SYS) 
  3. ;      Joe Miller   10 Mar 1985 
  4. ;      This patch corrects the 1027 printer timeout problem by prevent- 
  5. ;      ing the Operating System from generating an incorrect Data Frame 
  6. ;      checksum.  It consists of two logical modules.  The first module 
  7. ;      is executed once (at initialization) to chain into the "serial 
  8. ;      output ready" IRQ process.  The second module is invoked when an 
  9. ;      IRQ is generated for each serial output byte.  It checks to see 
  10. ;      if an invalid checksum is going to be sent for the current data 
  11. ;      frame, and, if so, prevents it from happening. 
  12. ;      NOTE:  This code is implemented as a standard "AUTORUN.SYS" file 
  13. ;             so that it may be used with any version of ATARI DOS. 
  14. ;             With some care, it may also be embedded directly within 
  15. ;             your own application program.  Note usage of cassette 
  16. ;             buffer.  Assemble with AMAC. 
  17. ;      ---------------------------------------------------------------- 
  18.  
  19.  
  20. FIXORG EQU     $0480           ; Location of SIO patch 
  21. VSEROR EQU     $020C           ; Serial Output Ready IRQ vector 
  22. CHKSUM EQU     $0031           ; SIO checksum accumulator 
  23. BUFRLO EQU     $0032           ; SIO output buffer pointer 
  24.  
  25.  
  26.        ORG     FIXORG          ; Start SIO patch 
  27.        PHP                     ; Save processor status 
  28.        SEI                     ; Disable IRQs for a moment 
  29.        LDA     VSEROR          ; Save current SIO output ready address 
  30.        STA     UVSER 
  31.        LDA     VSEROR+1 
  32.        STA     UVSER+1 
  33.        LDA     #low SIOFIX     ; Chain our fix into IRQ process 
  34.        STA     VSEROR 
  35.        LDA     #high SIOFIX 
  36.        STA     VSEROR+1 
  37.        PLP                     ; Re-enable interrupts 
  38.        RTS                     ; Return to OS --> 
  39.  
  40. YSAVE  DS      1               ; Temporary for Y-register  
  41. UVSER  DS      2               ; Serial Output Ready IRQ chain address 
  42.  
  43. SIOFIX LDA     CHKSUM          ; For each SIO 'Output Ready' interrupt 
  44.        BNE     SIOJMP          ; If current checksum is zero, then 
  45.        STY     YSAVE           ;    Save Y register 
  46.        LDY     #0              ;    Initialize index 
  47.        LDA     (BUFRLO),Y      ;    Get first buffer byte 
  48.        BEQ     YRESTR          ;    If 1st byte <> 0, then 
  49.        PLA                     ;       This data frame would cause timeout 
  50.        STA     CHKSUM          ;       Save stacked byte in checksum 
  51.        INY                     ;       Bump output buffer index 
  52.        CLC                     ;       'Pre-calculate' corrected checksum 
  53.        LDA     (BUFRLO),Y      ;       Add second byte in output buffer 
  54.        ADC     CHKSUM          ;       To first byte    (already sent) 
  55.        ADC     #0              ;       Including possible carry 
  56.        PHA                     ;       Save it on stack (NOT in CHKSUM!!) 
  57.                                ;    Endif 
  58. YRESTR LDY     YSAVE           ;    Restore Y-register 
  59.                                ; Endif 
  60. SIOJMP JMP     (UVSER)         ; Chain into system's interrupt server 
  61.  
  62.        END     FIXORG          ; End ---------------------------------- 
  63.  
  64.